package org.invigorare;

import org.invigorare.auctions.R;

import android.app.Activity;
import android.content.Context;
import android.widget.TextView;
import android.widget.Toast;

public class Utils {

	public static void showToast(Activity currActivity, String msg) {
		showToast(currActivity, msg, Toast.LENGTH_LONG);
	}
	
	public static void showToast(Activity currActivity, String msg, int lengthCode) {
		if (currActivity != null) {
			Toast toast = Toast.makeText(currActivity, msg, lengthCode);
			toast.show();
		}
	}
	
    public static void setFeeRateText(Context c, TextView view, float rate) {
    	view.setText(c.getString(R.string.fees_format_fee, rate));
    }
    
    public static void setCommissionRateText(Context c, TextView view, float rate) {
    	view.setText(c.getString(R.string.fees_format_commission, rate*100)); // percentage
    }
	
    public static void setFeeSaleText(Context c, TextView view, float weight, float rate) {
    	view.setText(c.getString(R.string.fees_format_sale_fee, weight*rate, rate));
    }
    
    public static void setCommissionSaleText(Context c, TextView view, float total, float rate) {
    	view.setText(c.getString(R.string.fees_format_sale_commission, total*rate, rate*100));
    }
    
}
